# _*_ condig: utf-8 _*_
# 计数器
import typing


class Counter(object):
    def __init__(self):
        self.__total = 0
        self.__count = 0


    def reload(self, total: int) -> None:
        '''重置'''
        self.__total = total


    def __iter__(self) -> typing.Iterable:
        return self


    def __next__(self) -> int:
        if self.__count == self.__total:
            raise StopIteration
        self.__count += 1
        return self.__count
